package com.ruoyi.web.controller.food;

import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.common.entity.Result;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.GrainsituationWarehouseTemposition;
import com.ruoyi.system.service.IGrainsituationWarehouseTempositionService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 仓房点位分布图Controller
 * 
 * @author ruoyi
 * @date 2025-04-03
 */
@RestController
@RequestMapping("/web/temposition")
@Api(tags = "仓房点位分布图")
public class GrainsituationWarehouseTempositionController extends BaseController<GrainsituationWarehouseTemposition>
{
    @Autowired
    private IGrainsituationWarehouseTempositionService grainsituationWarehouseTempositionService;

    /**
     * 查询仓房点位分布图列表-分页
     */
    @ApiOperation(value = "查询仓房点位分布图列表-分页")
    @PreAuthorize("@ss.hasPermi('web:temposition:page')")
    @GetMapping("/page")
    public Result<List<GrainsituationWarehouseTemposition>> page(GrainsituationWarehouseTemposition grainsituationWarehouseTemposition)
    {
        startPage();
        List<GrainsituationWarehouseTemposition> list = grainsituationWarehouseTempositionService.selectGrainsituationWarehouseTempositionList(grainsituationWarehouseTemposition);
        return getPageTable(list);
    }

    /**
     * 查询仓房点位分布图列表
     */
    @ApiOperation(value = "查询仓房点位分布图列表")
    @PreAuthorize("@ss.hasPermi('web:temposition:list')")
    @GetMapping("/list")
    public Result<List<GrainsituationWarehouseTemposition>> list(GrainsituationWarehouseTemposition grainsituationWarehouseTemposition)
    {
        List<GrainsituationWarehouseTemposition> list = grainsituationWarehouseTempositionService.selectGrainsituationWarehouseTempositionList(grainsituationWarehouseTemposition);
        return Result.ok(list);
    }

    /**
     * 导出仓房点位分布图列表
     */
    @ApiOperation(value = "导出仓房点位分布图列表")
    @PreAuthorize("@ss.hasPermi('web:temposition:export')")
    @Log(title = "仓房点位分布图", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GrainsituationWarehouseTemposition grainsituationWarehouseTemposition)
    {
        List<GrainsituationWarehouseTemposition> list = grainsituationWarehouseTempositionService.selectGrainsituationWarehouseTempositionList(grainsituationWarehouseTemposition);
        ExcelUtil<GrainsituationWarehouseTemposition> util = new ExcelUtil<GrainsituationWarehouseTemposition>(GrainsituationWarehouseTemposition.class);
        util.exportExcel(response, list, "仓房点位分布图数据");
    }

    /**
     * 获取仓房点位分布图详细信息
     */
    @ApiOperation(value = "获取仓房点位分布图详细信息")
    @PreAuthorize("@ss.hasPermi('web:temposition:query')")
    @GetMapping(value = "/{id}")
    public Result<GrainsituationWarehouseTemposition> getInfo(@PathVariable("id") Long id)
    {
        return Result.ok(grainsituationWarehouseTempositionService.selectGrainsituationWarehouseTempositionById(id));
    }

    /**
     * 新增仓房点位分布图
     */
    @ApiOperation(value = "新增仓房点位分布图")
    @PreAuthorize("@ss.hasPermi('web:temposition:add')")
    @Log(title = "仓房点位分布图", businessType = BusinessType.INSERT)
    @PostMapping
    public Result add(@RequestBody GrainsituationWarehouseTemposition grainsituationWarehouseTemposition)
    {
        return Result.ok(grainsituationWarehouseTempositionService.insertGrainsituationWarehouseTemposition(grainsituationWarehouseTemposition));
    }

    /**
     * 修改仓房点位分布图
     */
    @ApiOperation(value = "修改仓房点位分布图")
    @PreAuthorize("@ss.hasPermi('web:temposition:edit')")
    @Log(title = "仓房点位分布图", businessType = BusinessType.UPDATE)
    @PutMapping
    public Result edit(@RequestBody GrainsituationWarehouseTemposition grainsituationWarehouseTemposition)
    {
        return Result.ok(grainsituationWarehouseTempositionService.updateGrainsituationWarehouseTemposition(grainsituationWarehouseTemposition));
    }

    /**
     * 删除仓房点位分布图
     */
    @ApiOperation(value = "删除仓房点位分布图")
    @PreAuthorize("@ss.hasPermi('web:temposition:remove')")
    @Log(title = "仓房点位分布图", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public Result remove(@PathVariable Long[] ids)
    {
        return Result.ok(grainsituationWarehouseTempositionService.deleteGrainsituationWarehouseTempositionByIds(ids));
    }
}
